''' 
type 有两种用法： 
1. 查看类型
2. 运行期创建类对象
    
'''

def sleep(self,duration=3):
    print(f"{self.name} is sleeping...{duration} s")

Animal = type("Animal",(object,),dict(name=None,sleep=sleep))
a = Animal()
a.name= "Dog "
a.sleep(2)
print("type(Animal),",type(Animal))
print("type(a),",type(a))